home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
301-325
/
disk_313
/
uucp
/
uucp1.lzh
/
src
/
getty
/
passwd.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-01-10
|
2KB
|
82 lines
/*
* PASSWD.C
*
* (C) Copyright 1989-1990 by Matthew Dillon, All Rights Reserved.
*
*/
#include <exec/types.h>
#include <libraries/dosextens.h>
#include <stdio.h>
#include <stdlib.h>
#include <pwd.h>
#include <proto/all.h>
#include "log.h"
#define BTOCP(bp,type) ((type)((long)bp << 2))
extern long NullFH;
extern char LoginBuf[];
extern char PasswdBuf[];
extern char *DeviceName;
extern long DeviceUnit;
static struct passwd *Pas;
CheckLoginAndPassword()
{
Pas = getpwnam(LoginBuf);
if (Pas == NULL)
return(0);
if (strcmp(Pas->pw_passwd, "*") == 0)
return(1);
if (strcmp(PasswdBuf, Pas->pw_passwd) == 0)
return(1);
return(0);
}
void
RunPasswdEntry()
{
static char buf[256];
static char redir[128];
char *arg0 = Pas->pw_shell_arg0;
struct Process *proc = (struct Process *)FindTask(NULL);
APTR oldConsoleTask = proc->pr_ConsoleTask;
BPTR oldDir;
BPTR DirLock;
strcpy(redir, " ");
if (*arg0 == '*') {
++arg0;
sprintf(redir, " >UUSER:%s/%d/R1000G1 <UUSER:%s/%d/R1000G1 ", DeviceName, DeviceUnit, DeviceName, DeviceUnit);
} else {
if (LogToStdout == 0)
strcpy(redir, " >null: <null: ");
}
if (LogToStdout == 0)
proc->pr_ConsoleTask = (APTR)BTOCP(NullFH, struct FileHandle *)->fh_Port;
sprintf(buf, "%s%s%s -Getty -DEVICE %s -UNIT %d", arg0, redir, Pas->pw_shell_argn, DeviceName, DeviceUnit);
DirLock = (BPTR)Lock(Pas->pw_dir, SHARED_LOCK);
if (DirLock)
oldDir = (BPTR)CurrentDir(DirLock);
ulog(1, "Execute %s\n", buf);
Execute(buf, NullFH, NullFH);
proc->pr_ConsoleTask = oldConsoleTask;
if (DirLock)
UnLock(CurrentDir(oldDir));
ulog(1, "ran\n");
}